/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.beans;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Bone
 */
@Entity
@Table(name = "RELATORIOS", catalog = "", schema = "")
@NamedQueries({
    @NamedQuery(name = "Relatorios.findAll", query = "SELECT r FROM Relatorios r"),
    @NamedQuery(name = "Relatorios.findById", query = "SELECT r FROM Relatorios r WHERE r.id = :id"),
    @NamedQuery(name = "Relatorios.findByNome", query = "SELECT r FROM Relatorios r WHERE r.nome = :nome"),
    @NamedQuery(name = "Relatorios.findByDescricao", query = "SELECT r FROM Relatorios r WHERE r.descricao = :descricao")})
public class Relatorios implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    @GeneratedValue(generator = "GEN_RELATORIOS",strategy = GenerationType.SEQUENCE)
    @SequenceGenerator(name = "GEN_RELATORIOS",allocationSize = 1,sequenceName = "SQ_RELATORIOS")
    private Integer id;
    @Column(name = "NOME")
    private String nome;
    @Column(name = "DESCRICAO")
    private String descricao;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "relatorio")
    private List<ParametrosRelatorio> parametrosRelatorioList;

    public Relatorios() {
    }

    public Relatorios(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        String oldNome = this.nome;
        this.nome = nome;
        changeSupport.firePropertyChange("nome", oldNome, nome);
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        String oldDescricao = this.descricao;
        this.descricao = descricao;
        changeSupport.firePropertyChange("descricao", oldDescricao, descricao);
    }

    public List<ParametrosRelatorio> getParametrosRelatorioList() {
        return parametrosRelatorioList;
    }

    public void setParametrosRelatorioList(List<ParametrosRelatorio> parametrosRelatorioList) {
        this.parametrosRelatorioList = parametrosRelatorioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Relatorios)) {
            return false;
        }
        Relatorios other = (Relatorios) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bs.beans.Relatorios[ id=" + id + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
